<template>
  <div class="send-list">
    <div class="goods-list mt20">
      <div v-for="item in list" :key="item.id">
        <div class="title">
          <el-row>
            <el-col :span="7">
              <div>Time：{{ item.payTime }}</div>
            </el-col>
            <el-col :span="7">
              <div>ID：{{ item.id }}</div>
            </el-col>
            <el-col :span="7">Total：{{ item.payMoney | num2Money }} KZ</el-col>
            <el-col :span="3">
              <div @click="checkDetail(item)" style="color:#fb8c24;cursor: pointer;text-decoration: underline;">
                Detail >>
              </div>
              </el-col>
          </el-row>
        </div>
        <div class="godds-item flex" >
          <div class="flex-none">
            <img style="cursor: pointer;" class="goods-img" :src="item.showImg" alt="" @click="checkDetail(item)"/>
          </div>
          <div class="flex-auto width0">
            <div class="goods-info flex flex-column flex-justify-content-between">
              <el-row>
                <el-col :span="20">
                  <div class="goods-name">{{ JSON.parse(item.goodsInfo).name }}</div>
                </el-col>
              </el-row>
              <el-row>
              <el-col :span="20">
                <div class="goods-desc">{{ $t('component.sendList.9') }}：{{ JSON.parse(item.goodsInfo).views }}</div>
              </el-col>
              <el-col :span="4"> </el-col>
            </el-row>
              <el-row>
                <el-col :span="20">
                  <div class="goods-desc">{{ JSON.parse(item.goodsInfo).categoryName }}</div>
                </el-col>
              </el-row>
            </div>
          </div>
        </div>
      </div>

    </div>
    <div class="text-center">
      <el-pagination :page-size="params.pageSize" :pager-count="11" layout="prev, pager, next" :total="total" @current-change="handleCurrent" @pre-click="handlePre" @next-click="handleNext"> </el-pagination>
    </div>
  </div>
</template>
<script>
import Api from '@/api';
import { Domain } from '@/constants';
export default {
  name: 'SendList',
  components: { },
  data() {
    return {
      domain: Domain,
      addDialogVisible: false,
      params: {
        pageSize: 10,
        pageNo: 1,
      },
      total: 0,
      selectType: [],
      list: [],
      typeList: [],
      editGoods: {},
    };
  },
  created() {
    this.loadSendList();
  },
  methods: {
    // 列表
    loadSendList() {
      Api.payOrderList(this.params).then((res) => {
        const { rows = [], total } = res;
        this.total = total;
        this.list = rows.map((item) => {
          const img = JSON.parse(item.goodsInfo).imgList ? JSON.parse(JSON.parse(item.goodsInfo).imgList)[0] : '';
          return Object.assign(item, { showImg: Domain + img });
        });
      });
    },
    handleCurrent(page) {
      this.params.pageNo = page;
      this.loadSendList();
    },
    handlePre(page) {
      this.params.pageNo = page;
      this.loadSendList();
    },
    handleNext(page) {
      this.params.pageNo = page;
      this.loadSendList();
    },
    checkDetail(val){
      console.log(val)
      this.$router.push({path:"/OrderDetail/"+val.id})
    }
  },
};
</script>
<style lang="scss" scoped>
.tabpanel-title {
  position: relative;
  font-size: 24px;
  color: #333;
  font-weight: bold;

  .color-primary {
    color: #fb8c24;
  }
}
.title{
  background-color: #fff;
  padding:16px 24px;
  font-size: 14px;
  color: #666;
}
.tabpanel-btn {
  button {
    width: 141px;
    height: 40px;
    background: #fb7924;
    border-radius: 4px;
    color: #fff;
    line-height: 38px;
    border: none;
    outline: none;
    cursor: pointer;
    &:hover {
      background: #fdaf66;
    }
    &:active {
      background: #e27e20;
    }
  }
}
/* list */
.goods-list {
  overflow: auto;
}
.godds-item {
  background-color: #fff;
  border-radius: 4px;
  padding: 16px 24px;
  margin-bottom: 24px;
  padding-top: 0;
}
.goods-img {
  border: 1px solid #707070;
  border-radius: 4px;
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: inline-block;
  margin-right: 24px;
}
.goods-info {
  width: 100%;
  // height: 180px;
}
.goods-name {
  color: #595959;
  font-size: 14px;
  font-weight: bold;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 1px;
}
.goods-price {
  color: #333;
  font-weight: bold;
  font-size: 18px;
}
.goods-desc {
  color: #999999;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-top: 5px;
}
.goods-user {
  font-size: 14px;
  color: #999999;
  display: flex;
  align-items: center;
}
.goods-user-head {
  width: 24px;
  height: 24px;
  background: #f2f2f2;
  border-radius: 50%;
  display: inline-block;
}
/* 未使用 */
.recommend-col {
  width: calc((100% - 96px) / 4);
  box-sizing: border-box;
  background-color: #fff;
  border-radius: 4px;
  margin-right: 32px;
  margin-bottom: 32px;
  overflow: hidden;
  &:nth-child(4n) {
    margin-right: 0;
  }
  .recommend-item-info {
    padding: 16px 16px 0;
    .recommend-item-img {
      height: 230px;
      width: 100%;
      display: block;
    }
    .recommend-item-title {
      color: #595959;
      font-size: 20px;
      height: 50px;
      width: 100%;
      text-overflow: ellipsis;
      overflow: hidden;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      .recommend-tag {
        color: #fff;
        font-size: 12px;
        background: linear-gradient(235deg, #ff7144 0%, #f63e2d 100%);
        display: inline-block;
        padding: 5px 10px;
        border-radius: 4px;
      }
    }
    .recommend-item-favorited {
      color: #fb5724;
    }
    .recommend-item-userinfo {
      font-size: 16px;
      color: #999999;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      img {
        width: 24px;
        height: 24px;
        border-radius: 100%;
        display: inline-block;
        background-color: red;
        margin-right: 5px;
      }
    }
    .recommend-item-price {
      font-size: 24px;
      color: #fb8c24;
      font-family: Arial Black;
      margin-bottom: 10px;
    }
  }
  .recommend-item-btns {
    display: flex;
    height: 45px;
    box-sizing: border-box;
    border-top: 1px solid #e8e8e8;
    .recommend-item-btn {
      flex: 1;
      width: 50%;
      box-sizing: border-box;
      height: 44px;
      line-height: 44px;
      color: #999999;
      text-align: center;
      font-size: 14px;
      white-space: nowrap;
      cursor: pointer;
      &:hover {
        color: #fb8c24;
      }
      &:not(:last-child) {
        border-right: 1px solid #e8e8e8;
      }
    }
  }
}
.el-dialog {
  background: #f5f5f5 !important;
}
</style>
